#include<bits/stdc++.h>
using namespace std;
namespace IO
{
	char buff[1<<21],*p1=buff,*p2=buff;
	char getch(){return p1==p2&&(p2=((p1=buff)+fread(buff,1,1<<21,stdin)),p1==p2)?EOF:*p1++;}
	template<typename T>void read(T &x){char ch=getch();int fl=1;x=0;while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getch();}while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getch();}x*=fl;}
	template<typename T>void read_s(T &x){char ch=getch();while(ch<'a'||ch>'z')ch=getch();while(ch>='a'&&ch<='z'){x+=ch;ch=getch();}}
	template<typename T,typename ...Args>void read(T &x,Args& ...args){read(x);read(args...);}
	char obuf[1<<21],*p3=obuf;
	void putch(char ch) {if(p3-obuf<(1<<21))*p3++=ch;else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;}
	char ch[100];
	template<typename T>void write(T x) {if(!x)return putch('0');if(x<0)putch('-'),x*=-1;int top=0;while(x)ch[++top]=x%10+48,x/=10;while(top)putch(ch[top]),top--;}
	template<typename T,typename ...Args>void write(T x,Args ...args) {write(x);write(args...);}
	void put(string s){for(int i=0;i<s.size();i++)putch(s[i]);}
	void flush(){fwrite(obuf,p3-obuf,1,stdout);}
}
using namespace IO;
int n;
int a[200005],b[200005];
namespace sub1
{
	int ans[200005];
	void Main()
	{
		memset(ans,0x3f,sizeof ans);
		for(int i=1;i<=n;i++)
		{
			int mn1=1e9,mn2=1e9;
			for(int j=i;j<=n;j++) mn1=min(mn1,a[j]),mn2=min(mn2,b[j]),ans[j-i+1]=min(ans[j-i+1],abs(mn1-mn2));
		}
		for(int i=1;i<=n;i++) write(ans[i]),putch('\n');
	}
}
namespace sub2
{
	namespace Nene
	{
		int st[200005][20],lg[200005];
		void bld()
		{
			for(int i=1;i<=n;i++) st[i][0]=i;
			for(int i=2;i<=n;i++) lg[i]=lg[i/2]+1;
			for(int j=1;j<20;j++)
				for(int i=1;i+(1<<j)-1<=n;i++)
					if(a[st[i][j-1]]<a[st[i+(1<<j-1)][j-1]]) st[i][j]=st[i][j-1]; 
					else st[i][j]=st[i+(1<<j-1)][j-1];
		}
		inline int query(int l,int r)
		{
			int k=lg[r-l+1];
			if(a[st[l][k]]<a[st[r-(1<<k)+1][k]]) return st[l][k];
			return st[r-(1<<k)+1][k];
		}
	}
	namespace Elaina
	{
		struct segt
		{
			int val,tag;
			segt(){val=tag=1e9;}
		}t[200005<<2];
		#define ls (root<<1)
		#define rs (root<<1|1)
		#define mid (l+r>>1)
		void change(int x,int y,int v,int root=1,int l=1,int r=n)
		{
			if(l>=x&&r<=y) return t[root].tag=min(t[root].tag,v),t[root].val=min(t[root].val,v),void();
			if(x<=mid) change(x,y,v,ls,l,mid);
			if(y>mid) change(x,y,v,rs,mid+1,r);
			t[root].val=min({t[ls].val,t[rs].val,t[root].tag});
		}
		int query(int x,int tag=1e9,int root=1,int l=1,int r=n)
		{
			if(l==r) return min(tag,t[root].val);
			tag=min(tag,t[root].tag);
			if(x<=mid) return query(x,tag,ls,l,mid);
			return query(x,tag,rs,mid+1,r);
		}
	}
	void solve(int l,int r)
	{
		if(l>r) return;
		if(l==r) return Elaina::change(1,1,abs(a[l]-b[l])),void();
		int p=Nene::query(l,r);
		solve(l,p-1);solve(p+1,r);
		Elaina::change(1,r-l+1,abs(a[p]-b[1]));
	}
	void Main()
	{
		Nene::bld();
		solve(1,n);
		for(int i=1;i<=n;i++) write(Elaina::query(i)),putch('\n');
	}
}
int main()
{
	freopen("min.in","r",stdin);
	freopen("min.out","w",stdout);
	read(n);
	for(int i=1;i<=n;i++) read(a[i]);
	for(int i=1;i<=n;i++) read(b[i]);
	if(n<=5000) sub1::Main();
	else sub2::Main();
	flush();
	return 0;
}
